package com.example.houseweb.controller;

import com.example.housecommon.model.User;
import com.example.housecommon.result.ResultMsg;
import org.apache.commons.lang3.StringUtils;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-05-27
 **/
public class UserHelper {


    public static ResultMsg validate(User account) {
        if(StringUtils.isBlank(account.getEmail())) {
            return ResultMsg.errorMsg("Email 有误");
        }
        if(StringUtils.isBlank(account.getName())) {
            return ResultMsg.errorMsg("Name 有误");
        }
        if(StringUtils.isBlank(account.getConfirmPasswd()) || StringUtils.isBlank(account.getPasswd()) ||
                 ! account.getPasswd().equals(account.getConfirmPasswd())) {
            return ResultMsg.errorMsg("密码 有误");
        }
        if(account.getPasswd().length()<6) {
            return ResultMsg.errorMsg("密码小于6位");
        }
        return ResultMsg.successMsg("");
    }


}

